package ore.example.pokemonPb;

import ore.example.pokemonPb.command.GiveGen1PokemonCommand;
import ore.example.pokemonPb.commond.PokePb;
import ore.example.pokemonPb.commond.ReloadCommand;
import ore.example.pokemonPb.utils.RewardData;
import org.bukkit.plugin.PluginLogger;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.Objects;

public final class PokemonPb extends JavaPlugin {

    @Override
    public void onEnable() {
        // Plugin startup logic
        RewardData.init(this);
        saveDefaultConfig(); // 这句非常关键！
        this.getCommand("第一世代").setExecutor(new GiveGen1PokemonCommand());
        this.getCommand("第二世代").setExecutor(new ore.example.pokemonPb.command.GiveGen2PokemonCommand());

        this.getCommand("宝可梦图鉴").setExecutor(new PokePb());
        this.getCommand("重新加载图鉴存储").setExecutor(new ReloadCommand());

        // 注册所有世代命令到同一个执行器
        for (int i = 1; i <= 9; i++) {
            Objects.requireNonNull(getCommand("图鉴" + i)).setExecutor(new PokePb());
        }
    }

    @Override
    public void onDisable() {
        // Plugin shutdown logic
    }
}
